package Demo5;

import java.io.File;
import java.io.IOException;

public class CreateFoldersAndFiles extends Thread{
    private static final Object lock = new Object();
    @Override
    public void run() {
        synchronized (lock) {
            for (char c = 'a'; c <= 'e'; c++) {
                File folder = new File("D:/text/" + c);
                if (!folder.exists()) {
                    folder.mkdirs();
                }
                for (int i = 1; i <= 10000; i++) {
                    File file = new File("D:/text/" + c + "/" + c + i + ".txt");
                    try {
                        file.createNewFile();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }
}
